package com.ruoyi.project.system.house.renovation.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.house.renovation.mapper.HouseRenovationMapper;
import com.ruoyi.project.system.house.renovation.domain.HouseRenovation;
import com.ruoyi.project.system.house.renovation.service.IHouseRenovationService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 房源装修Service业务层处理
 * 
 * @author f_baisi
 * @date 2020-08-27
 */
@Service
public class HouseRenovationServiceImpl implements IHouseRenovationService 
{
    @Resource
    private IdGererateFactory idGererateFactory;

    @Autowired
    private HouseRenovationMapper houseRenovationMapper;

    /**
     * 查询房源装修
     * 
     * @param id 房源装修ID
     * @return 房源装修
     */
    @Override
    public HouseRenovation selectHouseRenovationById(String id)
    {
        return houseRenovationMapper.selectHouseRenovationById(id);
    }

    /**
     * 查询房源装修列表
     * 
     * @param houseRenovation 房源装修
     * @return 房源装修
     */
    @Override
    public List<HouseRenovation> selectHouseRenovationList(HouseRenovation houseRenovation)
    {
        return houseRenovationMapper.selectHouseRenovationList(houseRenovation);
    }

    /**
     * 新增房源装修
     * 
     * @param houseRenovation 房源装修
     * @return 结果
     */
    @Override
    public int insertHouseRenovation(HouseRenovation houseRenovation)
    {
        houseRenovation.setId(this.idGererateFactory.nextStringId());
        return houseRenovationMapper.insertHouseRenovation(houseRenovation);
    }

    /**
     * 修改房源装修
     * 
     * @param houseRenovation 房源装修
     * @return 结果
     */
    @Override
    public int updateHouseRenovation(HouseRenovation houseRenovation)
    {
        return houseRenovationMapper.updateHouseRenovation(houseRenovation);
    }

    /**
     * 删除房源装修对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHouseRenovationByIds(String ids)
    {
        return houseRenovationMapper.deleteHouseRenovationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除房源装修信息
     * 
     * @param id 房源装修ID
     * @return 结果
     */
    @Override
    public int deleteHouseRenovationById(String id)
    {
        return houseRenovationMapper.deleteHouseRenovationById(id);
    }

    @Override
    public HouseRenovation findByName(String renovation) {
        return this.houseRenovationMapper.findByName(renovation);
    }
}
